package com.lagou.Title3;

import com.lagou.task18.ThreadCallableTest;

import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test {

    public static void main(String[] args) {

        //创建线程池
        ExecutorService executorService = Executors.newFixedThreadPool(10);
        File f3 = new File("d:/zuoye3");
        File f2 = new File("d:/jiazuoye");

        //遍历给子目录个开一个线程 ，通过线程进行复制到对应目标目录的位置
        File[] files = f3.listFiles();
        for (File tf : files){
            //给线程池布置任务
            System.out.println("为文件" + tf.getPath() + "开启线程");
            executorService.submit(new Copy(tf,f2));
        }


        //3.关闭线程池
        executorService.shutdown();
        }
    }


